Lazy(T) Constructor (Func(T), Boolean)

Task Parallel System.Threading

Initializes a new instance of the Lazy<(Of <(T>)>) class that uses a specified initialization function and a specified thread-safety mode.

Namespace:  System
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Public Sub New ( _
	valueFactory As Func(Of T), _
	isThreadSafe As Boolean _
)
C#
public Lazy(
	Func<T> valueFactory,
	bool isThreadSafe
)

Parameters

valueFactory
Type: System..::.Func<(Of <(T>)>)
The Func<(Of <(T>)>) invoked to produce the lazily-initialized value when it is needed.
isThreadSafe
Type: System..::.Boolean
true if this instance should be usable by multiple threads concurrently; false if the instance will only be used by one thread at a time.

Exceptions

ExceptionCondition
System..::.ArgumentNullExceptionvalueFactory is a null reference (Nothing in Visual Basic).

See Also